<?php

use think\facade\Route;


// api登录接口无需token模块
Route::group('api', function () {
    // 用户路由
    Route::group('user', function () {
        Route::post('sendSms', 'api.User/sendSms'); // 发送短信
        Route::post('register', 'api.User/register'); // APP注册
        Route::post('login', 'api.User/login'); //登录接口
        Route::post('createCaptcha', 'api.User/createCaptcha'); // 获取图形验证码
        Route::post('getSystemInfo', 'api.User/getSystemInfo'); // 获取配置信息
        Route::post('retrieve', 'api.User/retrieve'); //找回密码
        Route::any('writeOffUser', 'api.User/writeOffUser'); //注销用户
        Route::any('userAgreement', 'api.User/userAgreement'); //用户协议
    });
    // 订单路由
    Route::group('order', function () {
        Route::post('orderTips', 'api.Order/orderTips'); //订单到期提醒
    });
    // 首页路由
    Route::group('index', function () {
        Route::any('getSystemInfo', 'api.Index/getSystemInfo'); // 获取配置信息
        Route::any('checkVersion', 'api.Index/checkVersion'); // 获取更新信息
        Route::any('serviceProtocol', 'api.Index/serviceProtocol'); //注销用户
        Route::any('privacyPolicy', 'api.Index/privacyPolicy'); //注销用户
    });
})->allowCrossDomain();


Route::group('api', function () {
    // 首页路由
    Route::group('index', function () {
        Route::post('index', 'api.Index/index');
    });
    // 群聊
    Route::group('group', function () {
        Route::any('groupUserArr', 'common.Group/groupUserArr');
        Route::any('joinGroup', 'common.Group/joinGroup');
        Route::any('kickOutGroup', 'common.Group/kickOutGroup');
        Route::any('modifyGroupTitle', 'common.Group/modifyGroupTitle');
    });
    Route::group('article', function () {
        Route::post('getArticleList', 'api.Article/getArticleList');
        Route::post('getArticleDetail', 'api.Article/getArticleDetail');
        Route::post('getLastArticleInfo', 'api.Article/getLastArticleInfo');
    });
    Route::group('message', function () {
        Route::post('getOtherUserMessageRecord', 'api.Message/getOtherUserMessageRecord');
    });
    Route::group('user', function () {
        Route::post('shortMessage', 'api.User/shortMessage'); //短信验证接口
        Route::post('index', 'api.User/index'); //测试中间件 
        Route::post('getUserInfo', 'api.User/getUserInfo'); //个人信息
        Route::post('setUserInfo', 'api.User/setUserInfo'); //设置 修改用户信息
        Route::post('setPassword', 'api.User/setPassword'); //修改密码
        Route::post('avatar', 'api.User/avatar'); //设置 修改用户头像

        Route::post('bindUid', 'api.User/bindUid'); // 用户绑定
        Route::post('getFriendCount', 'api.User/getFriendCount'); // 获取部门人数
        Route::post('getFriendList', 'api.User/getFriendList'); // 获取部门人
        Route::post('logout', 'api.User/logout'); // 退出登录
        Route::post('setUserLoginStatus', 'api.User/setUserLoginStatus'); // 设置用户登录状态
        Route::post('getOtherUserInfo', 'api.User/getOtherUserInfo'); // 获取某个用户信息
        Route::post('setAutoReply', 'api.User/setAutoReply'); // 自动回复语
        Route::post('getUserLoginStatus', 'api.User/getUserLoginStatus'); // 用户登录状态
    });
    // 聊天
    Route::group('im', function () {
        Route::post('getContactList', 'api.Im/getContactList'); // 好友列表
        Route::post('getContacts', 'api.Im/getContacts'); // 好友列表
        Route::post('sendMessage', 'api.Im/sendMessage'); // 发送消息
        Route::post('getUserInfo', 'api.Im/getUserInfo'); //获取用户信息
        Route::post('getMessageList', 'api.Im/getMessageList'); // 聊天记录
        Route::post('setMsgIsRead', 'api.Im/setMsgIsRead'); //设置当前窗口的消息默认为已读
        Route::post('undoMessage', 'api.Im/undoMessage'); // 撤回消息
        Route::post('removeMessage', 'api.Im/removeMessage'); //删除消息
        Route::post('isNotice', 'api.Im/isNotice'); // 消息免打扰
        Route::post('sendToMsg', 'api.Im/sendToMsg'); // 向用户发送消息
        Route::post('readAtMsg', 'api.Im/readAtMsg'); // 阅读@消息
        Route::post('getDepartmentCount', 'api.Im/getDepartmentCount'); // 部门人数
        Route::post('getDepartmentList', 'api.Im/getDepartmentList'); // 部门成员列表
        Route::post('getMessageRecord', 'api.Im/getMessageRecord'); // 搜索跳转聊天记录
        Route::post('getUserSign', 'api.Im/getUserSign'); // 获取语音通话签名
        Route::post('sendToMsg', 'api.Im/sendToMsg'); // 向用户发送消息
    });
    //订单
    Route::group('order', function () {
        Route::post('orderList', 'api.Order/orderList'); //订单列表
        Route::post('evaluate', 'api.Order/evaluate'); //评价订单,可以传递评价
        Route::post('complaint', 'api.Order/complaint'); //投诉订单
        Route::post('designer', 'api.Order/designer'); //查询部门下全部设计师
        Route::post('assignSales', 'api.Order/assignSales'); //指派销售
        Route::post('assignDesigner', 'api.Order/assignDesigner'); //指派设计师
        Route::post('estOrder', 'api.Order/estOrder'); //创建订单销售创建的
        Route::post('handle', 'api.Order/handle'); //投诉订单处理
        Route::post('supplement', 'api.Order/supplement'); //补充需求
        Route::post('returnPath', 'api.Order/returnPath'); //代收款返还路径选择
        Route::post('orderState', 'api.Order/orderState'); //修改订单状态
        Route::post('chiefEstOrder', 'api.Order/chiefEstOrder'); //创建订单 销售总监创建的
        Route::post('stopOrder', 'api.Order/stopOrder'); // 暂停订单
        Route::post('startOrder', 'api.Order/startOrder'); // 开始订单
        Route::post('getChatInfo', 'api.Order/getChatInfo'); // 查看聊天记录
        Route::post('refundVoucher', 'api.Order/refundVoucher'); //下载退款凭证
        Route::post('orderDetails', 'api.Order/orderDetails'); //根据订单id查询订单详情
        Route::post('manuscriptTime', 'api.Order/manuscriptTime'); //提交交稿时间
        Route::post('getCreateOrderOptionArr', 'api.Order/getCreateOrderOptionArr'); // 获取创建订单时的选项
        Route::post('assignOrders', 'api.Order/assignOrders'); //指派订单列表
        Route::post('updateOrder', 'api.Order/updateOrder'); // 修改订单信息
        Route::post('getOrderFieldArr', 'api.Order/getOrderFieldArr'); // 订单扩展字段
        Route::post('editInvoiceInfo', 'api.Order/editInvoiceInfo'); // 修改开票信息
        Route::post('setOrderSubStatus', 'api.Order/setOrderSubStatus'); // 修改订单子状态
        Route::post('applyOrderService', 'api.Order/applyOrderService'); // 申请售后
        Route::post('setOrderMemo', 'api.Order/setOrderMemo'); // 订单备忘录
        Route::post('delOrder', 'api.Order/delOrder'); // 删除订单
        Route::post('getRoleOrderStatusArr', 'api.Order/getRoleOrderStatusArr'); // 取用户可以设置的订单状态
        Route::post('getRelatedOrder', 'api.Order/getRelatedOrder')->name('获取关联订单');
        Route::post('assignSubOrderDesigner', 'api.Order/assignSubOrderDesigner')->name('子订单指派设计师');
    });
    //部门
    Route::group('department', function () {
        Route::post('designerAdd', 'api.Department/designerAdd'); //选择部门新增设计师
        Route::post('saleAdd', 'api.Department/saleAdd'); //当前销售总监部门下新增销售
        Route::post('designerDel', 'api.Department/designerDel'); //删除用户 设计师和销售都能用
        Route::post('modifyEmployees', 'api.Department/modifyEmployees'); //修改员工信息 设计师和销售都能用
        Route::post('designerDepartment', 'api.Department/designerDepartment'); //查询全部设计师部门
        Route::post('saleDepartment', 'api.Department/saleDepartment'); //查询全部销售部门
        Route::post('addLoginCode', 'api.Department/addLoginCode'); //总监添加登录码
        Route::post('modifyLoginCode', 'api.Department/modifyLoginCode'); //总监修改登录码
        Route::post('generate', 'api.Department/generate'); //生成登陆码
        Route::post('queryLoginCode', 'api.Department/queryLoginCode'); //售后总监查询登录码
        Route::post('getUserInfo', 'api.Department/getUserInfo'); //根据用户id查询用户信息

    });
    // 文件上传
    Route::group('upload', function () {
        Route::post('uploadFile', 'api.Upload/uploadFile'); //聊天文件上传
        Route::post('uploadAvatar', 'api.Upload/uploadAvatar'); // 上传头像
        Route::post('fileUpload', 'api.Upload/fileUpload'); // 订单文件上传
        Route::post('collectImg', 'api.Upload/collectImg'); // 上传收藏表情
        Route::post('getCollectImgList', 'api.Upload/getCollectImgList'); // 收藏列表
        Route::post('delCollectImg', 'api.Upload/delCollectImg'); // 删除收藏
        Route::post('upload', 'api.Upload/upload'); // 上传文件
    });
})->allowCrossDomain()->middleware('ApiAuth');
